home *** CD-ROM | disk | FTP | other *** search
/ Steal This CD / steal_this_cd.iso / Chapter 07 - Where the Hackers Are / virc200.exe / {app} / script.txt < prev    next >
Text File  |  2003-05-16  |  60KB  |  1,392 lines

  1. Scripting documentation for ViRC 2.0 and later
  2. ----------------------------------------------
  3.  
  4. This file describes changes to the Versus language as documented in
  5. versus.txt and ovs.txt.
  6.  
  7. The Versus language is based on ViRCScript, which was created by
  8. Adrian Cable for Visual IRC '96. Among the differences are enhanced
  9. support for objects, toolbars, lists and arrays. Also, instead of all
  10. scripts running in the same environment, a separate interpreter is
  11. created for each server, which affects object event handlers.
  12.  
  13. Last updated 13 Apr 2001 for 2.0pre6 - see changes.txt for later additions.
  14.  
  15. Variables
  16. =========
  17.  
  18. $scripthost
  19.   Contains "ViRC".
  20. $ver
  21.   Contains a description of the current version of the client, such as
  22.   "ViRC 2.0".
  23. $build
  24.   Contains an integer describing the current version of the client, such
  25.   as 200.
  26. $prebuild
  27.   Contains the current prerelease number, or 0 if this is a release version.
  28. $N
  29.   Contains the nick of the current server or DCC chat window. Undefined when
  30.   the script is running on the global interpreter.
  31. $server
  32.   Describes the current server: either "global", "unconnected", or the
  33.   server's name for itself.
  34.  
  35. Commands
  36. ========
  37.  
  38. Exit:
  39.   Quits the client.
  40.  
  41. NewServerWindow:
  42.   Creates a new server connection window.
  43.  
  44. ShowClientSetup:
  45.   Displays the client configuration window.
  46.  
  47. ShowDCCList:
  48.   Toggles display of the DCC list window.
  49.  
  50. ShowNotifySetup:
  51.   Displays the notify list configuration window.
  52.  
  53. ShowServerList:
  54.   Displays the server list window.
  55.  
  56. ShowScriptLog:
  57.   Brings the script log window to the front, if ViRC was started with the
  58.   -scriptlog parameter.
  59.  
  60. Connect:
  61.   Causes the current server window to connect.
  62.  
  63. Disconnect:
  64.   Causes the current server window to disconnect.
  65.  
  66. Server <server name>:
  67.   Connects the current server window to another IRC server.
  68.   <server name> may take the form of either 'irc.cris.com',
  69.   'irc.cris.com:6665', or 'irc.cris.com:6665%password'. If a port is not given,
  70.   the default is 6667.
  71.  
  72.   This command will attempt to match a server list entry by looking for an
  73.   entry with the supplied server name, then the supplied host and port, and
  74.   finally the supplied host and any port. For example, a server entry named
  75.   "prison" with the hostname irc.prison.net and port 6670 can be matched by
  76.   '/server prison', '/server irc.prison.net:6670', or just
  77.   '/server irc.prison.net'. '/server prison:6667' will override the entry's port
  78.   and connect to irc.prison.net on port 6667, but it will use all the other
  79.   settings from the entry.
  80.  
  81.   If <server name> is prefixed by an asterisk, ViRC will not change the
  82.   supplied hostname or port, and it will not match a server list entry by the
  83.   server name. For example, '/server *prison' will connect to a host named
  84.   "prison" on port 6667, even though the server entry named "prison" specifies
  85.   a different host and port.
  86.  
  87. Quote <text>:
  88. Raw <text>:
  89.   Sends the text directly to the server. Quote and Raw are equivalent.
  90.  
  91. Msg <target> <text>:
  92.   Sends the text to <target> as a private message. <target> may be an IRC
  93.   nickname or channel name, or the name or number of a DCC chat preceded by
  94.   an equal sign (e.g., '=myfriend'). If you want to send text to a channel,
  95.   you should use Say instead.
  96.   
  97.   If you override Msg, your alias will be called for text entered in query
  98.   and DCC chat windows.
  99.  
  100. Say [channel] <text>:
  101.   Sends the text to <channel>. If <channel> is omitted, the text is sent to
  102.   the currently active channel.
  103.  
  104. Notice <target> <text>:
  105.   Sends the text to <target> as a private or channel notice. <target> may be
  106.   an IRC nickname or channel name.
  107.  
  108. Quit [message]:
  109.   Disconnects the current server window with a quit message. If <message> is
  110.   omitted, a default message will be supplied.
  111.  
  112. TextOut [-nohilite] [> window] <color> <text>:
  113.   Displays text in a window, using a specific color. If a right angle bracket
  114.   follows the command name, the next word specifies the window (a channel
  115.   name, query name, DCC chat name preceded by an equal sign, or '.' for the
  116.   server window). If the bracket and window name are omitted, the text is
  117.   displayed to the currently active window, or if the active window belongs
  118.   to a different server, the text is displayed in the server notices window
  119.   of the current server.
  120.   
  121.   If the -nohilite option is given and the target window is not active, the
  122.   corresponding window tab will not be highlighted. Use this for messages that
  123.   do not demand the user's attention.
  124.   
  125.   If <window> is specified but does not refer to an existing window, the text
  126.   will not be displayed unless <window> is an appropriate name for a query
  127.   window, in which case a query window will automatically be created.
  128.  
  129.   If <window> is a comma-separated list of window names, each one will be tried
  130.   in order: query1,query2,#channel will first try query1, then query2, then
  131.   #channel, and display in the first window that exists. If none of them exist,
  132.   the text will not be shown unless the last name refers to a query window, in
  133.   which case it will be created automatically.
  134.   
  135.   <window> can also be an object handle prefixed by a percent sign to display
  136.   the text in a TRichEdit or TMonkeySex control that has been created with OVS.
  137.   If the handle is invalid or does not refer to a control of the correct type,
  138.   no text is displayed.
  139.   
  140.   If the text contains any \L characters (ASCII 10), the enclosed text will be
  141.   displayed in ecHyperlink and underlined, and will act as a hyperlink when
  142.   double-clicked: \Lwww2.foo.com\L. ViRC will add these automatically, so a
  143.   script should only add \L when it knows that the client won't recognize the
  144.   enclosed text as a link (but the client must be able to handle it as a link
  145.   once it's clicked!). Double-clicking the link runs 'WebHyperlink <text>'; if
  146.   WebHyperlink is an alias, it can use the $C variable to determine which 
  147.   channel the link was in. Any other attribute codes inside \L will terminate
  148.   the link.
  149.   
  150.   If the text contains any \S characters (ASCII 13), the enclosed text will be
  151.   displayed in ecScriptLink and will run a command when clicked or double-
  152.   clicked: \Schannel:#ViRC\S. Note that the text must contain a colon, and that
  153.   the text before the colon determines which command will be run; the example
  154.   will run a command called click_channel (the "channel:" will not be visible
  155.   to the user). The command will receive the word 'single' or 'double' as its
  156.   first parameter (depending on whether it was clicked once or twice), and the
  157.   text after the colon as its remaining parameters. You can pass additional
  158.   parameters at the beginning by putting spaces in the text:
  159.   '\Schannel #ViRC:Click here to join #ViRC.\S' will run this when clicked:
  160.     click_channel #ViRC single Click here to join #ViRC.
  161.   This command can use $C to determine which channel the link was in. Any other
  162.   attribute codes inside \S will terminate the link.
  163.  
  164. TextOutBitmap [-nohilite] [> window] <color> <bitmap> <text>:
  165.   Displays text in a window, prefixed by a bitmap. <bitmap> can either be
  166.   a filename (which must be all one word) or an integer returned by the
  167.   $bitmap() function.
  168.  
  169. FlushBitmapCache:
  170.   Empties the internal bitmap cache. Use this if a bitmap is changed after
  171.   first being loaded and you want to display the new one.
  172.  
  173. FlushBitmapCache <filename>:
  174.   Removes only the specified file from the bitmap cache.
  175.  
  176. CTCP <target> <text>:
  177.   Sends the text to <target> as a CTCP (Client-To-Client Protocol) request.
  178.  
  179. RCTCP <target> <text>:
  180.   Sends the text to <target> as a CTCP reply.
  181.  
  182. Ver <target>:
  183.   Sends a CTCP version request to <target>. This is exactly equivalent to
  184.   'CTCP <target> VERSION'.
  185.  
  186. Ping <target>:
  187.   Sends a CTCP ping request to <target>. This is equivalent to
  188.   'CTCP <target> PING $*mtime()'.
  189.  
  190. Mode <channel> <mode change>:
  191.   Attempts to change the channel mode.
  192.  
  193. Umode <mode change>:
  194.   Attempts to change your user mode. This is equivalent to
  195.   'Mode $N <mode change>'.
  196.  
  197. Names <channel>:
  198.   Retrieves a list of names of users on the channel.
  199.  
  200. Who <channel>:
  201.   Retrieves a detailed list of users on the channel.
  202.  
  203. OnServer <id> <command>:
  204.   Executes a command on another server. <id> is the index of the server's
  205.   entry in $ServerList(), which is also the number that appears in the server
  206.   window's title bar. If <id> is 0, the command will be executed on the
  207.   global interpreter.
  208.  
  209. Load <filename> [parameters]:
  210.   Loads a text file and executes it as script code. If the filename contains
  211.   spaces, surround it with double quotes. The file will be passed
  212.  
  213. Topic [channel] [new topic]:
  214.   Attempts to change the topic on a channel. If <channel> is omitted, the
  215.   current channel will be used. If <new topic> is omitted, the current topic
  216.   will be retrieved.
  217.  
  218. Kick [channel] <nick> [reason]:
  219.   Attempts to kick someone from a channel. If <channel> is omitted, the
  220.   current channel will be used. If <reason> is omitted, a default reason will
  221.   be provided by the IRC server.
  222.  
  223. KB [channel] <nick> [reason]:
  224.   Attempts to ban and kick someone from a channel. If <channel> is omitted,
  225.   the current channel will be used. If <reason> is omitted, a default reason
  226.   will be provided by the IRC server.
  227.  
  228. Ban [channel] <nick>:
  229.   Attempts to ban someone from a channel. If <channel> is omitted, the current
  230.   channel will be used.
  231.  
  232. Part [channel]:
  233.   Leaves the channel. If <channel> is omitted, leaves the current channel.
  234.  
  235. Query <nick> [message]:
  236.   Creates a new query window for <nick>. If <message> is specified, it will be
  237.   sent (via 'Msg <nick> <message>') as soon as the window is created.
  238.  
  239. AddToIAL <nick> <address>:
  240.   Adds the given nick and address to ViRC's IAL (Internal Address List), for
  241.   use with $getaddress().
  242.  
  243. RemoveFromIAL <nick>:
  244.   Removes the given nick from the IAL.
  245.  
  246. Me [channel] <text>:
  247.   Sends the text to the channel as a CTCP ACTION. If <channel> is omitted, the
  248.   action is sent to the currently active channel.
  249.  
  250. Desc <target> <text>:
  251.   Sends the text to <target> (a channel, nickname, or DCC chat name preceded
  252.   by an equal sign) as a CTCP ACTION. If you want to send an action to a
  253.   channel, you should use Me instead.
  254.   
  255.   If you override Desc, your alias will be called when /me is used in a query
  256.   or DCC chat window.
  257.  
  258. MenuHint <name> on <tree> = <text>:
  259.   Sets a hint for a menu item. The hint will be displayed in the status bar of
  260.   the main ViRC window while the menu item is highlighted.
  261.  
  262. DCC Send <nick> [filename]:
  263.   Sends the file to <nick> using the DCC protocol. If <filename> is omitted, a
  264.   standard file dialog box will appear and allow the user to choose a file.
  265.   
  266.   If the other person is using a client that supports it, you should use TDCC
  267.   instead.
  268.  
  269. DCC TSend <nick> [filename]:
  270. TDCC Send <nick> [filename]:
  271.   Sends the file to <nick> using the Turbo DCC protocol. If <filename> is
  272.   omitted, a standard file dialog box will appear and allow the user to choose
  273.   a file. DCC TSend and TDCC Send are equivalent.
  274.  
  275.   Turbo DCC is not supported by all clients. However, it is supported by BIRC,
  276.   PIRCH, XiRCON, and BitchX.
  277.  
  278. DCC Accept [filename]:
  279.   When used in an <OnDCCRequest> event, automatically accepts the request. If
  280.   the request is a file transfer and <filename> is specified, the file will be
  281.   saved with that name. If the file already exists, it will be overwritten.
  282.  
  283. DCC Reject:
  284.   When used in an <OnDCCRequest> event, automatically cancels the request.
  285.  
  286. DCC Resume <offset> [filename]:
  287.   When used in an <OnDCCRequest> event, automatically accepts the request. If
  288.   the request is a file transfer and <filename> is specified, the file will be
  289.   saved with that name. If the file already exists, the transfer will be
  290.   resumed from the specified offset.
  291.  
  292. DCC Request <type> <nick> <user@host> <params>:
  293.   Adds a DCC request to the DCC list window and runs the <OnDCCRequest> event
  294.   for it. <type> can be either CHAT, SEND, or TSEND. If <type> is CHAT,
  295.   <params> is two words: the IP address and the port. If <type> is SEND or
  296.   TSEND, <params> is four words: the filename, IP address, port, and file
  297.   size. If the filename contains spaces, it should be surrounded by double
  298.   quotes. If <type> is SEND (but not TSEND), the file size is optional.
  299.  
  300. Min <window>:
  301. Max <window>:
  302. Restore <window>:
  303. Close <window>:
  304. Show <window>:
  305. Hide <window>:
  306.   Minimizes, maximizes, restores, closes, shows, or hides the window.
  307.   <window> can also be !Main to operate on the main ViRC window, except for
  308.   Show and Hide. Note that when you click the window's minimize button, the
  309.   window is actually hidden, not minimized.
  310.  
  311. SetInputLine <window> <text>:
  312.   Sets the contents of <window>'s input line.
  313.  
  314. Clear [window]:
  315.   Clears the output display of the given window. If <window> is omitted,
  316.   the current window's output will be cleared.
  317.  
  318. WebHyperlink <URL>:
  319.   Opens the URL using your default web browser.
  320.  
  321. Notify [nicks]:
  322.   Modifies the notify list. <nicks> is a space-separated list of nicks. Each
  323.   nick is added to the list, or removed if it is prefixed with a minus sign.
  324.   For example, 'Notify foo -bar -baz' would add foo, remove bar, and remove
  325.   baz. If <nicks> is omitted, the current notify list is shown.
  326.  
  327. FireEvent [-one] <name> [args]:
  328.   Runs the event with the given name, using <args> as parameters. Only events
  329.   whose masks match <args> will run. The first word of <args> will be passed
  330.   in as $0, and so on. <name> may contain wildcards, in which case all the
  331.   events with matching names and masks will be fired. If the -one option is
  332.   given, only the most specific matching event will be fired.
  333.  
  334. FireMenuItem [> channel] <item> on <tree> [= parameters]:
  335.   Runs the specified menu item handler. If the angle bracket and <channel> are
  336.   specified, $C will be set to <channel>; otherwise, it will be set to the
  337.   active window's name. If the equal sign and <parameters> are specified, the
  338.   menu item will receive <parameters> as $1-. $0 will be set to the item's
  339.   name prefixed with a '!'.
  340.  
  341. SetUserField <nick!user@host> <fieldname> <data>:
  342.   Associates the string <data> with the given user mask and field. <fieldname>
  343.   can be any word, but you should limit the number of different fields to
  344.   save space.
  345.  
  346. DelUserField <nick!user@host> <fieldname>:
  347.   Deletes the user list entry for the given user mask and field. Only the
  348.   specific entry for this mask will be removed; using DelUserField with the
  349.   mask '*!*@*.foo.com' will not remove an entry for '*!user@ppp*.foo.com'.
  350.  
  351. Log Open <window>:
  352.   Begins logging in the named window.
  353.  
  354. Log Close <window>:
  355.   Ends logging in the named window.
  356.  
  357. DNS <hostname/ip/nickname>:
  358.   Consults your nameserver to translate a hostname to an IP address or vice
  359.   versa, then displays the results. This will block script execution while
  360.   waiting for the DNS reply, but won't freeze the client.
  361.   
  362.   If the parameter contains no dots and doesn't start with a number, it
  363.   will be treated as a nickname, and looked up with $getaddress(). To
  364.   prevent this, prefix the hostname with a *: /dns *localhost
  365.  
  366. Cycle <channel>:
  367.   Leaves and rejoins a channel without closing its window.
  368.  
  369. Asay <text>:
  370.   Says the text to every channel on the current server.
  371.  
  372. Ame <text>:
  373.   Sends the text as an action to every channel on the current server.
  374.  
  375. SimulateServerData <text>:
  376.   Fires internal and user-defined events as if <text> had just arrived from
  377.   the server. The events are fired immediately, even if there is unprocessed
  378.   text in the actual server socket buffer.
  379.  
  380. Kill <nick> <reason>:
  381.   Boots <nick> off the IRC network if you are an IRC operator.
  382.  
  383. Away [reason]:
  384.   Marks you as away for the given reason; this text will appear in your
  385.   /whois listing and when someone sends you a private message. If <reason>
  386.   is omitted, you will no longer be marked as away.
  387.  
  388. UnEvent <name>:
  389.   Deletes the event with the given name, if one exists.
  390.  
  391. SetServData <server name> <text>:
  392.   Sets the 'scriptdata' field of a server entry.
  393.  
  394. SetNetData <network name> <text>:
  395.   Sets the 'scriptdata' field of a network entry. <network name> must be
  396.   quoted as a list entry, since it can contain spaces or be an empty string
  397.   (for the 'no network' entry).
  398.  
  399. AddScriptControl <area> <type> <caption> <name> [options]:
  400.   Creates a new control in either the client setup window or the server list
  401.   for scripts to easily maintain their settings. The value of the control can
  402.   be changed by the user and the changes will automatically be saved.
  403.  
  404.   <area> determines where the control appears and how the values are stored. It
  405.   can be either "config" (to appear in client setup), "network" (to appear on
  406.   the network page of the server list), or "server" (to appear on the server
  407.   page of the server list). "config" controls are saved as a client-wide
  408.   setting and can be manipulated with SetSetting and $getsetting(); "network"
  409.   and "server" controls are saved with each network or server and can be
  410.   manipulated with SetNetSetting/$getnetsetting() and SetServSetting/
  411.   $getservsetting().
  412.  
  413.   <type> determines what kind of control appears. Possible values are "edit",
  414.   "check", "radio", and "button". Note that "button" controls simply run a
  415.   command; there is no data in the control for the user to edit. A button could
  416.   be used to bring up an OVS dialog box with more settings, for example.
  417.  
  418.   <caption> is the string that will be displayed on the control (for a check
  419.   box or button) or as a label next to the control (for an edit box or radio
  420.   buttons). It should be quoted as a list item.
  421.  
  422.   <name> is the name of the field used to manipulate the control's value in
  423.   $getsetting() and so on, unless the control is a button, in which case it is
  424.   the name of the command used to implement the button. The command will be
  425.   called with $1 as "click" when the button is clicked. The client will also
  426.   call it as a function with $1 as "display" when it wishes to retrieve a
  427.   string that will appear to the right of the button (when the form containing
  428.   the button is shown, and after the button is clicked); return a string in
  429.   $fresult, or return an empty string if none is appropriate.
  430.  
  431.   The interpretation of <options> depends on the control type. For radio
  432.   buttons, <options> should be a list of strings (each quoted as list items)
  433.   that will be used as captions of the radio buttons. One button will be
  434.   created for each string in this list, and the value of the control will be a
  435.   number from 0 to one less than the number of buttons. For edit boxes,
  436.   <options> can be "password" if the characters typed in the box should appear
  437.   onscreen as asterisks. For check boxes, <options> can be "transparent" if the
  438.   user should be allowed to set it to greyed, rather than all the way checked
  439.   or unchecked (in which case the value will be 2). <options> has no meaning
  440.   for buttons.
  441.  
  442. DLL <filename> <function> [data]:
  443.   Loads the DLL specified by <filename>, and calls <function> with the
  444.   parameter <data>. If <data> is omitted, an empty string is passed. The
  445.   calling conventions are described in vircdll.txt.
  446.  
  447. Exec <filename> [parameters]:
  448.   Executes the file, optionally passing a parameter string. This is just like
  449.   typing the filename and parameters into the Run dialog box - it will open
  450.   a program, document, or URL.
  451.  
  452. Timer [name] <seconds> <repeats> <command>:
  453.   Creates a new timer called <name>, waiting <seconds> seconds, repeating
  454.   <repeats> times, and running <command>. If <name> is omitted, a unique name
  455.   will be generated. If <repeats> is 0, the timer repeats forever. <command>
  456.   will not be evaluated before it is run; if it should be, prefix it with Eval.
  457.   
  458.   Timer names are shared across all servers, and must not start with a digit.
  459.   If a timer called <name> already exists, it will be deleted first.
  460.  
  461. MTimer [name] <millisecs> <repeats> <command>:
  462.   Same as Timer, but the delay is given in milliseconds (1/1000 second) instead
  463.   of seconds.
  464.  
  465. Timers:
  466. Timers all:
  467.   Displays a list of all timers running on the current server, or on all
  468.   servers if 'timers all' is used.
  469.  
  470. UnTimer <name>:
  471.   Deletes the timer called <name>.
  472.  
  473. Functions
  474. =========
  475.  
  476. $NewServerWindow():
  477.   Creates a new server window and returns its ID for use with OnServer.
  478.  
  479. $StrTrim(<text>):
  480.   Returns <text> after removing a leading colon (if present), then removing
  481.   any leading or trailing control-A characters.
  482.  
  483. $NickTrim(<text>):
  484.   Returns <text> after removing any leading nickname flags (@, %, or +).
  485.  
  486. $IsChannel(<text>):
  487.   Returns 1 if <text> could be the name of a channel, or 0 if not. ViRC
  488.   considers any string beginning with a # or & to be a legal channel name.
  489.  
  490. $NickList(<channel>):
  491.   Returns a list of all the nicknames on <channel>, or the null string if you
  492.   aren't on that channel.
  493.  
  494. $OpList(<channel>):
  495.   The same as $NickList(), but only returns the names of channel operators
  496.   (which are flagged with an @ in the channel window's nick list).
  497.  
  498. $VoiceList(<channel>):
  499.   The same as $NickList(), but only returns the names of channel voices
  500.   (which are flagged with a + in the channel window's nick list).
  501.  
  502. $HalfOpList(<channel>):
  503.   The same as $NickList(), but only returns the names of channel half-ops
  504.   (which are flagged with a % in the channel window's nick list).
  505.  
  506. $PeonList(<channel>):
  507.   The same as $NickList(), but only returns the names of peons (users who are
  508.   not ops, voices, or half-ops).
  509.  
  510. $IsOn(<nick> <channel>):
  511.   Returns 1 if <nick> appears in $NickList(<channel>), or 0 if not.
  512.  
  513. $IsOp(<nick> <channel>):
  514.   Returns 1 if <nick> appears in $OpList(<channel>), or 0 if not.
  515.  
  516. $IsVoice(<nick> <channel>):
  517.   Returns 1 if <nick> appears in $VoiceList(<channel>), or 0 if not.
  518.  
  519. $IsHalfOp(<nick> <channel>):
  520.   Returns 1 if <nick> appears in $HalfOpList(<channel>), or 0 if not.
  521.  
  522. $GetMode(<channel>):
  523.   Returns the mode string for <channel>, or an empty string if the channel
  524.   is not open. This string includes parameters, such as "+stl 15".
  525.  
  526. $GetTopic(<channel>):
  527.   Returns the topic string for <channel>, or an empty string if the channel
  528.   is not open.
  529.  
  530. $GetKey(<channel>):
  531.   Returns the key for <channel>, or an empty string if the channel is not
  532.   open or does not have mode +k set.
  533.  
  534. $GetLimit(<channel>):
  535.   Returns the user limit for <channel>, or 0 if the channel is not open or
  536.   does not have mode +l set.
  537.  
  538. $GetWindowId(<window>):
  539.   Returns a number that uniquely identifies the specified window. These
  540.   numbers are unique among all server windows for the client, all DCC chat
  541.   windows for the client, and all channels and query windows for the current
  542.   server window. For server windows and DCC chats, this number appears in the
  543.   title bar. For other window types, this number is not visible to the user.
  544.  
  545. $ChannelList():
  546.   Returns a list of all the channel windows for the current server.
  547.  
  548. $ServerList():
  549.   Returns a list of all the server windows. The index of each item in this
  550.   list is the number that appears in the server window's title bar and is
  551.   returned by $GetWindowId(). The first element is "global", and any spaces
  552.   between server windows are "destroyed".
  553.  
  554.   For example: Suppose you create a server window and do not connect it. Then
  555.   you create another and connect it to irc.concentric.net. $ServerList() will
  556.   return "global unconnected irc.concentric.net:6667". Now suppose you close
  557.   the first server window, leaving the second one connected. $ServerList()
  558.   will return "global destroyed irc.concentric.net:6667".
  559.  
  560. $CurrentServer():
  561.   Returns the index of the current server in the list returned by
  562.   $ServerList(), or 0 if the function is called from the global interpreter.
  563.  
  564. $IsQuerying(<nick>):
  565.   Returns 1 if there is a query window open for <nick> on the current server,
  566.   or 0 if not.
  567.  
  568. $QueryList():
  569.   Returns a list of all the query windows for the current server.
  570.  
  571. $IsDCCChatting(<nick>):
  572.   Returns 1 if there is a DCC chat window open for <nick>, or 0 if not.
  573.  
  574. $DCCChatList():
  575.   Returns a list of all the DCC chat windows open on all server windows (since
  576.   DCC chat works independently of the server).
  577.  
  578. $DCCChatNick(<id>):
  579.   Returns the nick on the other end of the specified DCC chat, or the empty
  580.   string if there is no such DCC chat. <id> can be a number, a nick, or a
  581.   window name.
  582.  
  583. $GetAddress(<nick>):
  584.   Returns the address (user@host) of <nick>, or 'unknown@unknown' if there is
  585.   no such nick on IRC. This function will read the address out of the IAL if
  586.   it has been added with AddToIAL.
  587.  
  588. $IsInIAL(<nick>):
  589.   Returns 1 if <nick> is in the current server's IAL, or 0 if not.
  590.  
  591. $EncodeIP(<dotted ip>):
  592.   Returns <dotted ip> converted into an integer in network byte order. This is
  593.   useful for sending DCC requests.
  594.  
  595. $DecodeIP(<numeric ip>):
  596.   Returns <numeric ip> converted into a dotted IP address. This is useful for
  597.   displaying an incoming DCC request.
  598.  
  599. $AliasList():
  600.   Returns a list containing the name of every alias that has been added. This
  601.   can also be retrieved with the GetAliasList method of TStringList.
  602.  
  603. $EventList():
  604.   Returns a list containing the name of every event that has been added. This
  605.   can also be retrieved with the GetEventList method of TStringList.
  606.  
  607. $EventMask(<event name>):
  608.   Returns the given event's activation mask.
  609.  
  610. $EventExists(<event name>):
  611.   Returns 1 if the event exists, or 0 if not.
  612.  
  613. $GetMenuHint(<name> on <tree>):
  614.   Returns the given menu item's hint message.
  615.  
  616. $mIRCColor(<num>):
  617.   Returns the RGB value of the mIRC color specified by <num>, or 0 if the
  618.   number is out of the range 0..15.
  619.  
  620. $ActiveWindow():
  621.   Returns the window name of the currently active child window, or . if there
  622.   is no active child window or the active window belongs to another server.
  623.  
  624. $ActiveServer():
  625.   Returns the server ID number of the server that owns the active child
  626.   window, or 0 if there is no active child window or the active child is a
  627.   DCC chat window.
  628.  
  629. $Bitmap(<filename>):
  630.   Loads a .bmp image into the internal cache and returns a unique integer.
  631.   If the file has already been loaded, the same integer will be returned,
  632.   unless FlushBitmapCache has been called in the meantime.
  633.  
  634. $UhostToMask(<user@host>):
  635.   Generates a ban mask that matches the given user@host, of the form
  636.   *!*user@*host.
  637.  
  638. $NickToMask(<nick>):
  639.   Looks up the nick's address using $GetAddress(), then generates a matching
  640.   ban mask. If the nick's address cannot be found, a mask of the form
  641.   nick!*@* is returned. 
  642.  
  643. $Notify():
  644.   Returns the current notify list as a space-separated list of nicks.
  645.  
  646. $Notify(<nick>):
  647.   Returns 1 if the nick is in the notify list and currently signed on (as far
  648.   as ViRC knows), or 0 otherwise.
  649.  
  650. $TimeConnected():
  651.   Returns the number of seconds the current server window has been connected,
  652.   or 0 if the server is unconnected.
  653.  
  654. $GetSetting([path] <name>):
  655.   Reads a setting from ViRC's registry key. If <path> is specified, it is a
  656.   space-separated list of keys to traverse: for example,
  657.   $GetSetting(Notify Interval).
  658.  
  659.   ViRC saves its settings in:
  660.     HKEY_CURRENT_USER\Software\MeGALiTH Software\Visual IRC 2.
  661.  
  662. $GetUserField(<nick!user@host> <fieldname>):
  663.   Retrieves the string that has been associated with the given user and field,
  664.   or an empty string if no entry can be found. The most specific matching
  665.   entry that exists for that field will be used: for example, calling this
  666.   function for joe!user@ppp5.foo.com might return the string associated with
  667.   *!user@ppp*.foo.com.
  668.  
  669. $UserFieldList([fieldname]):
  670.   If <fieldname> is omitted, returns a list containing every field in the user
  671.   list; otherwise, returns a list containing every nick!user@host mask with
  672.   an entry in the given field. 
  673.  
  674. $IdleTime():
  675.   Returns the number of seconds that have passed since data was last sent to
  676.   the server.
  677.  
  678. $ServerHost():
  679.   Returns the hostname:port used to connect to the server, or an empty string
  680.   if there is no server connection.
  681.  
  682. $GetPath():
  683.   Returns the path where the ViRC executable is located, including the
  684.   trailing backslash.
  685.  
  686. $IsLogging(<window>):
  687.   Returns true if the named window is currently logging.
  688.  
  689. $DNS(<hostname/ip/nickname>):
  690.   Consults your nameserver to translate a hostname to an IP address or vice
  691.   versa, then returns the results (or an empty string if the attempt failed).
  692.   This will block script execution while waiting for the DNS reply but not
  693.   freeze the client.
  694.  
  695.   If the parameter contains no dots and doesn't start with a number, it
  696.   will be treated as a nickname, and looked up with $getaddress(). To
  697.   prevent this, prefix the hostname with a *: $dns(*localhost)
  698.  
  699. $IsIP(<text>):
  700.   Returns true if <text> is a valid numeric IP address. Note that strings like
  701.   '5' and '127.1' are valid IP addresses.
  702.  
  703. $SelectServer():
  704.   Displays the server list window so the user can choose a server entry by
  705.   double-clicking it, or selecting it and pushing OK. The return value is the
  706.   selected entry's server name, or an empty string if the user cancels.
  707.  
  708. $SelectNetwork():
  709.   Displays the server list window so the user can choose a network entry. The
  710.   return value is the selected entry's network name, or an empty string if the
  711.   user cancels or selects 'no network'.
  712.  
  713. $ServerID():
  714.   Returns the server name of the server entry currently being used, or an
  715.   empty string if there is none.
  716.  
  717. $NetworkID():
  718.   Returns the name of the network entry currently being used, or an empty
  719.   string if there is none.
  720.  
  721. $GetServSetting([server name] <setting name>):
  722.   Looks up a setting using the server entry, network entry, and global
  723.   configuration. If <server name> is supplied, the entry by that name will be
  724.   used instead of the currently active entry. Boolean settings are returned
  725.   as either 0 or 1. The available settings are:
  726.     nicklength (int), modeargs (int), defnicks (str), ident (str),
  727.     realname (str), atchan (bool), multinicks (bool), hostname (str),
  728.     network (str), password (str), scriptdata (str).
  729.   'defnicks' returns a list of nicks, in order: server-specific nicks,
  730.   network-specific nicks, and global default nicks. Each nick is quoted as a
  731.   list item. 'network' returns the name of the network associated with the
  732.   server.
  733.   An empty string will be returned if the setting is invalid, or if a server
  734.   name is given but no entry exists by that name.
  735.  
  736. $GetNetSetting([network name] <setting name>):
  737.   Looks up a setting using the network entry and global configuration. If
  738.   <network name> is supplied, the entry by that name will be used instead of
  739.   the currently active entry. Return values and available settings are the
  740.   same as above, except that 'defnicks' only returns network-specific and
  741.   global nicks, and these settings are not available: hostname, network,
  742.   password.
  743.  
  744. $PasswordQuery(<text>):
  745.   Shows a dialog box requesting a password from the user. This works just
  746.   like the $?= pseudo-function, but the password is masked with asterisks as
  747.   it is entered. If <text> contains a vertical bar, the text to the right of
  748.   it will be used as the default value (which is returned if the user
  749.   cancels): $passwordquery(Enter your password:|shazam)
  750.  
  751. $GetInputLine(<window>):
  752.   Returns the contents of <window>'s input line.
  753.  
  754. $StripAttrs(<text>):
  755.   Removes attribute codes (bold, italic, color, etc.) from <text> and returns
  756.   the plain text. 
  757.  
  758. $StripLinks(<text>):
  759.   Removes hyperlinks (\Lfoo\L) and script links (\Scmd:foo\S), leaving
  760.   attribute codes alone.
  761.  
  762. $DLL(<filename> <function> [data]):
  763.   Loads the DLL specified by <filename>, calls <function> with the
  764.   parameter <data>, and returns the result. If <data> is omitted, an empty
  765.   string is passed. The calling conventions are described in vircdll.txt. If
  766.   the DLL function does not return a value, $DLL() returns an empty string.
  767.  
  768. $Timer([name] <seconds> <repeats> <command>):
  769.   Creates a new timer called <name>, waiting <seconds> seconds, repeating
  770.   <repeats> times, and running <command>. If <name> is omitted, a unique name
  771.   will be generated. Returns the name of the new timer.
  772.   
  773.   If <repeats> is 0, the timer repeats forever. <command> will not be
  774.   evaluated before it is run; if it should be, prefix it with Eval.
  775.   
  776.   Timer names are shared across all servers, and must not start with a digit.
  777.   If a timer called <name> already exists, it will be deleted first.
  778.  
  779. $MTimer([name] <millisecs> <repeats> <command>):
  780.   Same as $Timer(), but the delay is given in milliseconds (1/1000 second)
  781.   instead of seconds.
  782.  
  783. $TimerExists(<name>):
  784.   Returns true if a timer called <name> exists.
  785.  
  786. $TimerList([serverid]):
  787.   Returns a list of all timers running on the identified server, or on all
  788.   servers if <serverid> is omitted.
  789.  
  790. $GetTimer(<name>):
  791.   Returns a string of the form "interval repeats command", where interval is
  792.   given in milliseconds and repeats is the number of times the timer will be
  793.   called again. Returns an empty string if no timer called <name> exists.
  794.  
  795. $LocalNick(=<ID>):
  796.   Returns your nickname on the specified DCC chat connection.
  797.  
  798. $RemoteNick(=<ID>):
  799.   Returns the remote user's nickname on the specified DCC chat connection.
  800.  
  801. Menu Trees
  802. ==========
  803.  
  804. ViRC's menu trees are MT_MAINMENU, MT_SERVERPOPUP, MT_NOTIFYPOPUP,
  805. MT_CHANNELTEXTPOPUP, MT_CHANNELNICKSPOPUP, MT_QUERYPOPUP, and MT_CHATPOPUP.
  806. Each menu tree should be zero or more lines of the form:
  807.   <id> <hotkey> <magic> <depth> <name>
  808. where <id> is a one-word identifier unique to this menu tree, <hotkey> is a
  809. string of the form "Alt+X" (or "<none>" for no hotkey), <magic> is a number
  810. describing the special behavior of this item, <depth> is how far this item is
  811. indented (0 for a top-level item), and <name> is the caption of the menu item
  812. (where an ampersand makes the next letter underlined, and && displays a single
  813. ampersand).
  814.  
  815. For MT_SERVERPOPUP, <magic> can take the following values:
  816.   0 - item is always enabled
  817.   1 - enabled when connected to the server
  818.   2 - disabled when connected to the server
  819.   3 - item is always disabled
  820. For MT_CHANNELTEXTPOPUP and MT_CHANNELNICKSPOPUP, it can take these values:
  821.   0 - item is always enabled
  822.   1 - enabled when opped on the channel
  823.   2 - disabled when opped on the channel
  824.   3 - item is always disabled
  825. Currently, for the other trees <magic> is ignored and the item is always
  826. enabled.
  827.  
  828. To assign code to a menu item, use the MenuItem block:
  829.   MenuItem M_CTCPVERSION on MT_CHANNELNICKSPOPUP
  830.     foreach ($i; $listfromwords($1-))
  831.       CTCP $i VERSION
  832.     endforeach
  833.   EndMenuItem
  834. To assign code that is run when you double-click in the area, use the special
  835. item ID "<DoubleClick>".
  836.  
  837. Menu item handlers run on the appropriate interpreter (the global interpreter
  838. for MT_MAINMENU and MT_CHATPOPUP, and the server window's interpreter for all
  839. others), and receive the following parameters and variables:
  840.   MT_MAINMENU, MT_SERVERPOPUP - none.
  841.   MT_NOTIFYPOPUP - all selected nicks in $1-, focused nick in $nick.
  842.   MT_CHANNELTEXTPOPUP - channel name in $C.
  843.   MT_CHANNELNICKSPOPUP - all selected nicks in $1-, focused nick in $nick,
  844.                          channel name in $C.
  845.   MT_QUERYPOPUP - nick of query target in $1, $nick, and $C.
  846.   MT_CHATPOPUP - nick of DCC chat target in $1 and $nick, window name in $C.
  847.  
  848. Note that even though $1- might look like a list, it isn't a real list. The
  849. elements might contain unquoted backslashes, which will cause list functions
  850. and ForEach loops to give incorrect results. Use $listfromwords($1-) if you
  851. need to access $1- like a list.
  852.  
  853. Events
  854. ======
  855.  
  856. Define an event using the syntax:
  857.   Event MyEventName "<event mask here>"
  858.     <code>
  859.   EndEvent
  860. where MyEventName is a unique name for the event, and <event mask here> is a
  861. standard VSInterp wildcard mask (using %, *, ?, and ¼). The event mask is
  862. evaluated before it's added, which lets you use variables and backslash escapes
  863. in the mask.
  864.  
  865. ViRC matches the event masks against text from the server (after removing any
  866. trailing newlines and CTCP delimiters) and fires the most specific event that
  867. matches. Each event is assigned a priority when it's created, which ViRC uses
  868. to compare the specificness of events. Each *, or ¼ in the mask earns it zero
  869. priority points, each % earns it one point, each ? earns it two points, and
  870. each other character (or escaped wildcard) earns it three points. The mask with
  871. the highest priority value is considered the most specific.
  872.  
  873. The word-break wildcard (¼, alt-0172) is useful for matching CTCP messages.
  874. Since ViRC automatically removes trailing CTCP delimiters (\A), this mask will
  875. match any CTCP VERSION request, but not CTCP VERSIONFOO:
  876.   % PRIVMSG % :\AVERSION¼
  877.  
  878. To run a specific event *in addition to* the less specific events, rather than
  879. *instead of* them, use the FallThrough command:
  880.   Event AnyCTCP "% PRIVMSG % :\A*"
  881.     TextOut > . ecCTCP *** CTCP $strtrim($3) from $nick
  882.   EndEvent
  883.   Event CTCPVERSION "% PRIVMSG % :\AVERSION¼"
  884.     ^RCTCP $nick VERSION I am proudly running $ver.
  885.     FallThrough
  886.   EndEvent
  887.  
  888. Script Hooks Called by ViRC
  889. ===========================
  890.  
  891. ViRC calls these script-defined events:
  892.   <OnStart*            called when ViRC starts.
  893.   <OnClose*            called just before ViRC exits.
  894.   <OnConnect*          called when the IRC server acknowledges the connect (in
  895.                        the 004 numeric). note that this is not fired
  896.                        immediately after the socket connects.
  897.   <OnDisconnect*       called when the IRC socket is closed.
  898.   <OnSocketOpen*       called as soon as the IRC socket connects, before any
  899.                        NICK or USER command is sent.
  900.   <OnCreateWindow*     called when a new ViRC form is created. $0 is the form
  901.                        type (TServerForm, TChannelForm, TDCCChatForm, or
  902.                        TQueryForm) and $1 is the window name. if the form is a
  903.                        DCC chat form, $1 contains the non-unique name (=nick)
  904.                        and $2 contains the unique name (=123).
  905.   <OnNewDCCChatText*   called when new text comes in on a DCC chat connection
  906.                        (ViRC doesn't display the text by itself). $0 is the
  907.                        nick, $1 is the window name, $2- is the text. only the
  908.                        most specific matching event will be run, unless
  909.                        FallThrough is used.
  910.   <OnDCCChatClosed*    called when the remote end closes a DCC chat
  911.                        connection. $0 is the nick and $1 is the window name.
  912.   <OnDCCRequest*       called when a new DCC request is added to the list
  913.                        (using the DCC Request command). see below.
  914.   <OnUserSetupOK*      called when the user clicks the OK button to close the
  915.                        client setup window and save changes.
  916.   <OnUserSetupCancel*  called when the user clicks the Cancel button to close
  917.                        the client setup window and discard changes.
  918.   <OnErrorConnecting*  called when a socket error occurs before the socket is
  919.                        connected. $0 is the error number and $1- is the
  920.                        message.
  921.   <OnMyChanText*       called by the built-in /say command to display text
  922.                        that the user types into a channel. $0 and $C are the
  923.                        channel, $1- is the text.
  924.   <OnMyPrivMsg*        called by the built-in /msg command to display text
  925.                        sent as a private message (other than in a query). $C
  926.                        is the active window, $0 is the target nick, and
  927.                        $1- is the text.
  928.   <OnMyNotice*         called by the built-in /notice command to display text
  929.                        sent as a notice. $C is the active window, $0 is the
  930.                        target nick or channel, and $1- is the text.
  931.   <OnMyCTCP*           called by the built-in /ctcp command to display CTCP
  932.                        requests sent by the user. $C is the active window, $0
  933.                        is the target nick or channel, and $1- is the text.
  934.   <OnMyRCTCP*          called by the built-in /rctcp command to display CTCP
  935.                        replies sent by the user. $C is the active window, $0
  936.                        is the target nick or chanel, and $1- is the text.
  937.   <OnMyChanAction*     called by the built-in /me command to display actions
  938.                        the user performs in a channel. $C and $0 are the
  939.                        channel, $1- is the text.
  940.   <OnMyPrivAction*     called by the built-in /desc command to display
  941.                        actions sent privately to another user. $C is the
  942.                        active window, $0 is the target nick, and $1- is the
  943.                        text.
  944.   <OnMyQueryText*      called by the built-in /msg command to display text
  945.                        that the user types into a query or DCC chat. $C and $0
  946.                        are the window name (nick or =number), $1- is the text.
  947.                        $N is set to the appropriate local nickname when called
  948.                        for a DCC chat.
  949.   <OnMyQueryAction*    called by the built-in /desc command to display actions
  950.                        the user performs in a query. $C and $0 are the window
  951.                        name, $1- is the text. $N is set to the appropriate
  952.                        local nickname when called for a DCC chat.
  953.  
  954. All of these are called using wildcards, which means that <OnStart>,
  955. <OnStart_MyScript>, and <OnStartFoo> will all be called. Events with names
  956. surrounded by angle brackets will never be matched against text from the IRC
  957. server.
  958.  
  959. Event masks are still matched when calling hooks. This event:
  960.   Event <OnCreateWindow_Servers> "TServerForm *"
  961.     <code>
  962.   EndEvent
  963. will only run when a server form is created. However, with the exception of
  964. <OnNewDCCChatText*, all matching events will be called (not just the most specific one).
  965.  
  966. ViRC will also call user-defined aliases:
  967.   WEBHYPERLINK <url>         called when you double-click on a hyperlink.
  968.   CONNECT                    called when you click the server's connect button.
  969.   DISCONNECT                 called when you click the server's disconnect
  970.                              button.
  971.   SAY <channel> <text>       called when you type text in a channel, and by
  972.                              /asay.
  973.   ME <channel> <text>        called by /ame.
  974.   MSG <nick> <text>          called when you type text in a query, and by
  975.                              /query <nick> <text>.
  976.   MSG =<id> <text>           called when you type text in a DCC chat window.
  977.   DESC <nick> <text>         called when you use /me in a query.
  978.   DESC =<id> <text>          called when you use /me in a DCC chat window.
  979.   CTCP <nick> <text>         called by /ver and /ping.
  980.   QUIT <text>                called by /server when you're already connected.
  981.   PART <channel>             called when you close a channel window.
  982.   MODE <channel> <text>      called by /ban and /kb.
  983.   KICK <channel> <nick> <text>    called by /kb.
  984.   $NickToMask(<nick>)        called by /ban and /kb.
  985.  
  986. Writing an <OnDCCRequest> Event
  987. ===============================
  988.  
  989. The <OnDCCRequest> event is fired by the DCC Request command after the request
  990. is added to the DCC list. $nick, $user, and $host describe the nick and
  991. user@host that were passed in the DCC Request command. The other parameters
  992. are the type in $1 (CHAT, SEND, or TSEND), the encoded IP in $2, the remote
  993. port in $3, the file size in $4 (or 0 if the size is unknown), and the filename
  994. in $5-.
  995.  
  996. The event can run three special commands to automatically deal with the
  997. request:
  998.   DCC Reject                          aborts the transfer immediately.
  999.   DCC Accept [<filename>]             accepts the transfer immediately,
  1000.                                       optionally renaming it.
  1001.   DCC Resume <size> [<filename>]      resumes the transfer immediately,
  1002.                                       optionally renaming it. <size> is the
  1003.                                       position to start resuming from, where
  1004.                                       0 is the beginning of the file.
  1005.  
  1006. If the event doesn't run any of these commands, the request will stay in the
  1007. DCC list as usual.
  1008.  
  1009. Mappable Objects
  1010. ================
  1011.  
  1012. For the form name in a $MapObject(form name[:control name]) call, you can use
  1013. a window name, or one of the special values: 
  1014.  
  1015.   !Main - main ViRC form
  1016.   !UserSetup - configuration window
  1017.   !About - about box
  1018.   !DCCList - dcc list window
  1019.   !Notify - notify setup window
  1020.   !ScriptEditor - script editor
  1021.  
  1022. ViRC automatically adds the main form itself with object
  1023. handle 0. The mappable controls for each window type are:
  1024.  
  1025. Server windows (TServerForm)
  1026. ----------------------------
  1027.  
  1028. ConnectBtn, DisconnectBtn (TToolbarButton97) - the buttons to connect to and
  1029.    disconnect from the server.
  1030. ServerTxt (TEdit97) - the edit control containing the server name. 
  1031. IALTimer (TTimer) - the timer that runs every minute to clean out the IAL.
  1032. NotifyTimer (TTimer) - the timer that sends ISON commands for the notify list.
  1033. ServerPopup, NotifyPopup (TPopupMenu) - the popup menus.
  1034. Output (TMonkeySex) - the box where scrolling text is displayed.
  1035. Input (TMemo) - the box where text is entered.
  1036. Notify (TListBox) - the notify nicks list.
  1037. TopDock, BottomDock, LeftDock, RightDock (TDock97) - the docks where floating
  1038.    toolbars can be placed.
  1039. ServerToolbar (TToolbar97) - the toolbar containing ConnectBtn and
  1040.    DisconnectBtn.
  1041. ServerSelectionToolbar (TToolbar97) - the toolbar containing ServerTxt.
  1042. WindowTab (TToolbarButton97) - the button corresponding to this window on the
  1043.    tab bar.
  1044.  
  1045. Channel windows (TChannelForm)
  1046. ------------------------------
  1047.  
  1048. ChannelTextPopup, ChannelNicksPopup (TPopupMenu) - the popup menus.
  1049. Output (TMonkeySex) - the box where scrolling text is displayed.
  1050. Input (TMemo) - the box where text is entered.
  1051. NickList (TListBox) - the channel nicks list.
  1052. TopDock, BottomDock, LeftDock, RightDock (TDock97) - the docks where floating
  1053.    toolbars can be placed.
  1054. WindowTab (TToolbarButton97) - the button corresponding to this window on the
  1055.    tab bar.
  1056.  
  1057. Query windows (TQueryForm)
  1058. --------------------------
  1059.  
  1060. QueryPopup (TPopupMenu) - the popup menu.
  1061. Output (TMonkeySex) - the box where scrolling text is displayed.
  1062. Input (TMenu) - the box where text is entered.
  1063. TopDock, BottomDock, LeftDock, RightDock (TDock97) - the docks where floating
  1064.    toolbars can be placed.
  1065. WindowTab (TToolbarButton97) - the button corresponding to this window on the
  1066.    tab bar.
  1067.  
  1068. DCC Chat windows (TDCCChatForm)
  1069. -------------------------------
  1070.  
  1071. ChatPopup (TPopupMenu) - the popup menu.
  1072. Output (TMonkeySex) - the box where scrolling text is displayed.
  1073. Input (TMenu) - the box where text is entered.
  1074. TopDock, BottomDock, LeftDock, RightDock (TDock97) - the docks where floating
  1075.    toolbars can be placed.
  1076. WindowTab (TToolbarButton97) - the button corresponding to this window on the
  1077.    tab bar.
  1078.  
  1079. Main form (TMainForm)
  1080. ---------------------
  1081.  
  1082. MainMenu (TMainMenu) - the main menu.
  1083. StatusBar (TStatusBar) - the status bar. set the SimpleText property to change
  1084.    the displayed text.
  1085. TopDock, BottomDock, LeftDock, RightDock (TDock97) - the docks where floating
  1086.    toolbars can be placed.
  1087.  
  1088. Client setup form (TConfigForm)
  1089. -------------------------------
  1090.  
  1091. Use BCONV to get the code for this form.
  1092.  
  1093. Notify setup form (TNotifyForm)
  1094. -------------------------------
  1095.  
  1096. AddBtn, RemoveBtn (TButton) - the buttons to add or remove nicks.
  1097. NickList (TListBox) - a list box containing the nicks.
  1098. AutoNotify (TCheckBox) - the check box to enable automatic notify monitoring.
  1099. NotifyInterval (TEdit) - the edit box containing the number of seconds for
  1100.    auto-notify.
  1101. OKBtn, CancelBtn (TButton) - the OK and Cancel buttons.
  1102.  
  1103. About box (TAboutForm)
  1104. ----------------------
  1105.  
  1106. VersionLabel (TLabel) - a label containing the ViRC version.
  1107. OKBtn (TButton) - the OK button.
  1108.  
  1109. DCC list window (TDCCListForm)
  1110. ------------------------------
  1111.  
  1112. DCCList (TListBox) - a list box containing all the active DCC requests.
  1113.    however, it's an owner-draw control with no strings in its Items property,
  1114.    so it isn't very scriptable.
  1115. AcceptBtn (TButton) - the button to accept the currently selected request.
  1116. CloseBtn (TButton) - the button to abort the currently selected request.
  1117. DCCListPopup (TPopupMenu) - the popup menu for the list box.
  1118.  
  1119. Script log form (TScriptLogForm)
  1120. --------------------------------
  1121.  
  1122. LogOutput (TMonkeySex) - the output pane.
  1123. LogPopup (TPopupMenu) - the right-click menu.
  1124.  
  1125. Modifications to OVS
  1126. ====================
  1127.  
  1128. Methods added to TStrings
  1129. -------------------------
  1130.  
  1131.   LoadFromEvent <eventname>
  1132.     Fills the string list with the code of the named event.
  1133.   SaveToEvent <eventname>
  1134.     Creates or replaces an event with the given name, using the code from the
  1135.     string list.
  1136.   GetEventList
  1137.     Fills the string list with the names of all defined events.
  1138.   LoadFromMenuTree <treename>
  1139.     Fills the string list with the named menu tree, in the same format as
  1140.     described earlier.
  1141.   SaveToMenuTree <treename>
  1142.     Replaces the named menu tree using the description from the string list.
  1143.   GetMenuTreeList
  1144.     Fills the string list with the names of all available menu trees.
  1145.   LoadFromMenuItem <itemname> on <treename>
  1146.     Fills the string list with the code of the named menu item.
  1147.   SaveToMenuItem <itemname> on <treename>
  1148.     Replaces the named menu item using the code from the string list.
  1149.   GetMenuItemList <treename>
  1150.     Fills the string list with the names of all menu items on the named tree,
  1151.     in seemingly random order.
  1152.  
  1153. New TTabbedForm class
  1154. ---------------------
  1155.  
  1156. This is the same as TForm, but it creates a button on ViRC's tab bar. The
  1157. icon set with the form's Icon property is shown on the button.
  1158.  
  1159. Property:
  1160.   TabCaption (string)
  1161.     The text that appears on the button.
  1162.     
  1163. New TMonkeySex class
  1164. --------------------
  1165.  
  1166. This is the text scroller used on server/channel/query/DCC chat forms. (Blame
  1167. Gnowknaym for the name.)
  1168.  
  1169. Properties:
  1170.   Align, Font, ParentFont, PopupMenu - standard.
  1171.   Background (TColor)
  1172.     The default background color.
  1173.   BGBitmap (TBitmap)
  1174.     The background image.
  1175.   BGBitmapEnabled (boolean)
  1176.     If true, the BGBitmap will be used; otherwise, the background color will
  1177.     be used.
  1178.   BufferSize (integer)
  1179.     The number of scrollback lines to keep in memory.
  1180.   Hyperlink (TColor)
  1181.     The color to display hyperlinks in. (\Lfoo\L)
  1182.   ScriptLink (TColor)
  1183.     The color to display script links in. (\Scmd:foo\S)
  1184.   Logging (boolean)
  1185.     If true, the OnLogging event will be called for each line added.
  1186.  
  1187. Methods:
  1188.   Clear
  1189.     Erases all lines in the control.
  1190.   PageDown
  1191.     Scrolls down one page.
  1192.   PageUp
  1193.     Scrolls up one page.
  1194.  
  1195. Events:
  1196.   OnClick, OnDblClick - standard.
  1197.   OnCopyText
  1198.     Called when the user selects some text and releases the mouse button. The
  1199.     text is in $Text.
  1200.   OnHyperlink
  1201.     Called when the user double-clicks a hyperlink. The link text is in $Text.
  1202.   OnScriptLink
  1203.     Called when the user activates a script link. The associated command is in
  1204.     $Command, the visible text is in $Text, the mouse button is in $Button,
  1205.     the shift state is in $Shift, the client coordinates of the click are in
  1206.     $X and $Y, and the screen coordinates are $ScreenX and $ScreenY.
  1207.   OnLogging
  1208.     Called when a new line is added and logging is enabled. The text is in
  1209.     $Text.
  1210.  
  1211. New TSockets class for TCP connections
  1212. --------------------------------------
  1213.  
  1214. Create a TSockets object with the syntax $New(TSockets). These socket controls
  1215. will automatically use the specified SOCKS proxy settings for outgoing
  1216. connections, but listening for connections will not be possible over SOCKS.
  1217.  
  1218. If a socket error occurs and no OnErrorOccurred event handler is set, ViRC
  1219. will stop. If you don't plan to handle errors, you should at least set a
  1220. dummy event handler:  @p $socket.OnErrorOccurred = Nop
  1221. ('Nop' should not be confused with 'Nil', which unsets the event handler,
  1222. causing the error to go uncaught.)
  1223.  
  1224. Properties:
  1225.   IPAddr (string)
  1226.     The IP address or hostname to connect to.
  1227.   Port (string)
  1228.     The port number or name to connect to.
  1229.   LocalIPAddr (string)
  1230.     The IP address of the local host. May not be accurate if the host has
  1231.     more than one address. Read-only.
  1232.   RemoteIPAddr (string)
  1233.     The IP address of the host on the other end of the connection. If the
  1234.     connection is running through SOCKS, this will be the address of the
  1235.     proxy server. Read-only.
  1236.   SocketNumber (integer)
  1237.     The number of the currently active connection.
  1238.   MasterSocket (integer)
  1239.     The number of the listening connection, if this socket object is listening.
  1240.   Text (string)
  1241.     Reading this property receives data from the socket (and removes the data
  1242.     from the socket's input buffer); writing it sends data to the socket. This
  1243.     should only be read from an OnDataAvailable event handler.
  1244.   State (enumeration)
  1245.     The socket's level of activity: sockDisconnected, sockDNS (looking up a
  1246.     hostname), sockConnecting (waiting to connect to a host), sockConnected, or
  1247.     sockRequestedSocks (waiting for a response from the proxy server).
  1248.  
  1249. Methods:
  1250.   SConnect
  1251.     Attempts to connect to the host in IPAddr and the port in Port. The
  1252.     OnSessionConnected or OnErrorOccurred event will be called when the socket
  1253.     connects or fails to connect.
  1254.   SListen
  1255.     Begins listening for connections on the socket using the port number in
  1256.     Port.
  1257.   SListenOnFreePort()
  1258.     Picks an unused port number, begins listening for connections on that port,
  1259.     then returns the port number.
  1260.   SListenRange(<lowport> <highport>)
  1261.     Attempts to listen on a free port between <lowport> and <highport>.
  1262.     Returns the port number if successful, or 0 if unsuccessful.
  1263.   SCancelListen
  1264.     Cancels listening.
  1265.   SAccept()
  1266.     Accepts the connection and returns its connection number. Use this in an
  1267.     OnSessionAvailable event.
  1268.   SClose
  1269.     Closes the connection. Does not call the OnSessionClosed event.
  1270.   Send <text>
  1271.     Sends the text without a newline.
  1272.   SendCRLF <text>
  1273.     Sends the text, followed by a carriage return and linefeed.
  1274.   SetActiveConnection(<num>)
  1275.     Sets the active connection (just like setting the SocketNumber property)
  1276.     and returns the number of the previously active connection.
  1277.  
  1278. Events:
  1279.   OnStateChanged
  1280.     Called when the socket's State property changes. The new state is in the
  1281.     $State variable.
  1282.   OnDataAvailable
  1283.     Called when data is available for reading. Read the Text property to get
  1284.     the data. The socket number is in $Socket.
  1285.   OnDataNeeded
  1286.     Called when the socket is ready to write, either just after connecting or
  1287.     after a previous write failed. Set the Text property or use the Send or
  1288.     SendCRLF methods to write data. The socket number is in $Socket.
  1289.   OnSessionAvailable
  1290.     Called when a client is trying to connect to a listening socket. Call
  1291.     SAccept to accept the connection.
  1292.   OnSessionClosed
  1293.     Called when the remote host has closed the connection. Call SClose here
  1294.     to close down your side of the connection. The socket number is in $Socket.
  1295.   OnSessionConnected
  1296.     Called when an outgoing connection succeeds. The socket number is in
  1297.     $Socket.
  1298.   OnErrorOccurred
  1299.     Called when a socket error occurs. If this is not handled, the application
  1300.     will be stopped. The socket number is in $Socket, the error number is in
  1301.     $Error, and the error message is in $Msg.
  1302.  
  1303. TSockets example
  1304. ----------------
  1305.  
  1306. Outgoing connections:
  1307.   // create socket
  1308.   @ $socket = $new(TSockets)
  1309.   // set up events
  1310.   @p $socket.OnSessionConnected = SMTP_SESSIONCONNECTED
  1311.   @p $socket.OnErrorOccurred = SMTP_ERROROCCURRED
  1312.   // we'll use mail.myisp.com for SMTP (port 25)
  1313.   @p $socket.IPAddr = mail.myisp.com
  1314.   @p $socket.Port = 25
  1315.   // connect
  1316.   $socket.SConnect
  1317.   
  1318.   // OnSessionConnected event handler
  1319.   Alias SMTP_SESSIONCONNECTED
  1320.     // send a message
  1321.     // get email addresses
  1322.     @l $to = $?="Enter an address to send mail to:"
  1323.     @l $from = $?="Enter your return address:"
  1324.     // SMTP identify to server (the socket is in $Sender)
  1325.     $Sender.SendCRLF HELO vircmail
  1326.     // SMTP message headers
  1327.     $Sender.SendCRLF MAIL FROM:$from
  1328.     $Sender.SendCRLF RCPT TO:$to
  1329.     // body
  1330.     $Sender.SendCRLF DATA
  1331.     $Sender.SendCRLF From: $from
  1332.     $Sender.SendCRLF To: $to
  1333.     $Sender.SendCRLF Subject: Mail sent from ViRC
  1334.     $Sender.SendCRLF
  1335.     $Sender.SendCRLF This message was brought to you by TSockets.
  1336.     // end message
  1337.     $Sender.SendCRLF .
  1338.     $Sender.SClose
  1339.   EndAlias
  1340.   
  1341.   // OnErrorOccurred event handler
  1342.   Alias SMTP_ERROROCCURRED
  1343.     // just show a message box
  1344.     MessageBox Socket error $Error occurred ($Msg)
  1345.   EndAlias
  1346.  
  1347. Multiple Interpreters
  1348. =====================
  1349.  
  1350. ViRC has a script interpreter for each server, and a global script interpreter
  1351. for action that isn't associated with a server. The global interpreter runs
  1352. ViRC.lib, <OnStart>, <OnClose>, main menu items, and DCC chat commands/events/
  1353. popups. The server interpreters run code for any command, event, or popup
  1354. that occurs in the server, channel, or query windows. OVS event handlers are
  1355. run by the interpreter that set them.
  1356.  
  1357. Window names and OVS object handles are only available to the interpreter
  1358. they belong to (although DCC chat window names can be used everywhere). This
  1359. means that if you create objects that need to be used from more than one
  1360. server, it's best to create them on the global interpreter.
  1361.  
  1362.  
  1363. Using BCONV
  1364. ===========
  1365.  
  1366. The included BCONV utility can be used to easily create forms in OVS. BCONV
  1367. translates form (.dfm) files created with Delphi into script files that can
  1368. be used without much modification.
  1369.  
  1370. BCONV can be used two ways. The first way reads a form from a binary DFM
  1371. file:
  1372.  
  1373.   C:\ViRC> bconv myform.dfm myform.vsc
  1374.  
  1375. The second way extracts a form resource from any program compiled with
  1376. Delphi:
  1377.  
  1378.   C:\ViRC> bconv ViRC.exe/TCONFIGFORM configform.vsc
  1379.  
  1380. The part before the slash is the EXE or DLL filename; the part after is the
  1381. resource name. To get a list of resources, use a question mark for the name:
  1382.  
  1383.   C:\ViRC> bconv ViRC.exe/?
  1384.  
  1385. Note that BCONV is not perfect, and many forms cannot be converted to OVS
  1386. that will work in ViRC. For example, BCONV doesn't make valid code from
  1387. forms that have controls with collections (like status bars), doesn't put a
  1388. dollar sign in front of the component name for properties that contain
  1389. objects, and ignores properties that contain binary data (like icons). Always
  1390. read over the output to ensure that it is valid.
  1391.  
  1392.